package mx.dota.activity;

import java.util.Timer;
import java.util.TimerTask;

import mx.dota.activity.base.BaseActivity;
import mx.dota.activity.publicFunction.MyApplication;
import net.miidi.ad.wall.AdWallManager;

import android.content.Intent;
import android.content.pm.ActivityInfo;
import android.os.Bundle;
import android.view.KeyEvent;
import android.view.View;
import android.widget.Button;

import mx.dota.R;

public class firstActivity extends BaseActivity {
	Intent localIntent;
	Timer timer;
	Button m_Exit;

	@Override
	protected void onCreate(Bundle savedInstanceState) {
		// TODO Auto-generated method stub
		super.onCreate(savedInstanceState);
		setContentView(R.layout.first);
		m_Exit = (Button) findViewById(R.id.btnExit);
		m_Exit.setOnClickListener(new View.OnClickListener() {

			@Override
			public void onClick(View v) {
				// TODO Auto-generated method stub
				MyApplication.getInstance().exit();
			}
		});

		MyApplication.getInstance().addActivity(this);
		localIntent = new Intent(this, menuActivity.class);
		timer = new Timer();
		TimerTask tast = new TimerTask() {
			@Override
			public void run() {
				firstActivity.this.startActivity(localIntent);
				// finish();
			}
		};
		timer.schedule(tast, 2200);

		AdWallManager.init(firstActivity.this, "3810", "wms9kpewas8pc3t6",
				false);

	}

	@Override
	protected void onResume() {
		// TODO Auto-generated method stub

		if (getRequestedOrientation() != ActivityInfo.SCREEN_ORIENTATION_PORTRAIT) {
			setRequestedOrientation(ActivityInfo.SCREEN_ORIENTATION_PORTRAIT);
		}
		super.onResume();
	}

	@Override
	public boolean onKeyDown(int keyCode, KeyEvent event) {
		// TODO Auto-generated method stub
		if (keyCode == KeyEvent.KEYCODE_MENU) {
			firstActivity.this.startActivity(localIntent);
			return true;
		}

		return super.onKeyDown(keyCode, event);
	}

}
